package com.zy.order.controller;

import com.zy.servicefeign.feign.OrderFeign;
import com.zy.servicefeign.feign.UserFeign;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * description
 *
 * @author ZY
 * @date 2021年01月22日 12:46
 **/
@RestController
@RequestMapping("/order")
public class TestCommonFeignController implements OrderFeign {

    /**
     * 使用聚合的feign测试
     */
    @Resource
    private UserFeign userFeign;

    @Override
    @GetMapping("/test1")
    public String test1() {
        System.out.println("用户模块通过网关调用订单模块接口，开始");
        String s = userFeign.test2();
        System.out.println("用户模块通过网关调用订单模块接口，结束，结果：" + s);
        return "【service-module-order 调用 service-module-user】 通过网关调用成功";
    }

    @Override
    @GetMapping("/test2")
    public String test2() {
        System.out.println("用户模块通过网关调用订单模块服务成功");
        return "用户模块通过网关调用订单模块服务成功";
    }

}
